package ua.org.enginer.utils {
	
	public function generatePassword(pLength:int=7):String {
		var vowels:Array = ['E', 'u', 'i', 'o', 'A', '2', '3', '4', '5', '6', '7', '8', '9']
		var novowels:Array = ['W', 'R', 't', 'p', 's', 'd', 'F', 'g', 'H', 'k', 'z', 'x', 'c', 'v', 'B', 'N', 'M']
		
		var password:String=''
		var vowel:int
		var novowel:int
		var flag:Boolean = false;
		
		for (var i:int; i<pLength;i++) {
			
			if(flag){
				vowel = rand(0, vowels.length)
				password += vowels[vowel]
			}else{
				novowel = rand(0, novowels.length)
				password += novowels[novowel]	
			}
			
			flag = !flag;
			
		}
  		
  		return password
  		
  		
  		function rand(min:int, max:int):int {
  			return min + Math.floor(Math.random()*(max-min))
  		}
	}
} 